<template>
  <div class="model" v-if="showModel" @click="cancel">
    <div class="content">
      <div class="title">{{title}}</div>
      <div class="text" v-html="content" v-if="isHtml"></div>
      <div class="text" v-html="content" v-else>{{content}}</div>
      <div class="btn-list">
        <div class="btn" v-if="showCancel" :style="{color:cancelColor}" @click.stop="cancel">{{cancelText}}</div>
        <div class="btn" :style="{color:confirmColor}" @click.stop="confirm">{{confirmText}}</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      showModel:false
    }
  },
  props:{
    showCancel:{
      type:Boolean,
      default:true
    },
    content:{
      type:String,
      default:'内容'
    },
    isHtml:{
      type:Boolean,
      default:false
    },
    cancelText:{
      type:String,
      default:'取消'
    },
    cancelColor:{
      type:String,
      default:'#333'
    },
     confirmText:{
      type:String,
      default:'确定'
    },
    confirmColor:{
      type:String,
      default:'#007aff'
    },
    title:{
      type:String,
      default:'最新公告'
    }
  },
  components: {

  },
  methods: {
    open(){
      this.showModel = true
    },
    confirm(){
      this.showModel = false
    },
    cancel(){
      this.showModel = false
    }
  }
}
</script>

<style scoped lang="less">
.model {
  width: 100%;
  height: 100%;
  position: fixed;
  background-color: rgba(0,0,0,.2);
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  .content {
    width: 600px;
    height: 700px;
    border-radius: 10px;
    background-color: #ffffff;
    padding: 30px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    .title{
      color: #000;
      font-size: 30px;
      font-weight: bold;
      text-align: center;
      padding-top: 20px;
      box-sizing: border-box;
    }
    .text {
      flex: 1;
      padding: 30px 0;
      box-sizing: border-box;
      color: #000;
      overflow-x: hidden;
      overflow-y: scroll;
      &::-webkit-scrollbar { width: 0 !important }
      /deep/p {
        color: #000;
      }
    }
    .btn-list {
      display: flex;
      align-items: center;
      justify-content: center;
      .btn {
        width: 50%;
        height: 80px;
        text-align: center;
        line-height: 80px;
        border-radius: 20px;
        background-color: #5c2223;
      }
    }
  }
}
</style>